#!/usr/bin/python
#readclipboard by Storm Dragon
#reads the text in the clipboard for you. Uses Twidge to retrieve tweets.
#Accessed by right clicking, click scripts, readclipboard
#Place in ~/.gnome2/nautilus-scripts/
#Library import section
import commands
import pygtk
import gtk
#Variable Declaration section
#Uncomment the speech system you want to use, festival by default.
voice = "spd-say -w"
#voice = "festival"
#voice = "espeak -v en-us"
#voice = "aoss swift"
#Get the clipboard
cb = gtk.clipboard_get()
#assign the clipboard contents to a variable.
cbText = cb.wait_for_text()
if isinstance(cbText, str) != True:
    cbText = "No text in clipboard."
if voice != "festival":
    commands.getoutput(voice + " '" + cbText + "'")
else:
    commands.getoutput("echo '" + cbText + "' | festival --tts")

